package com.cheetah.start.module.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.solon.service.impl.ServiceImpl;
import com.cheetah.start.module.system.domain.SysDictData;
import com.cheetah.start.module.system.mapper.SysDictDataMapper;
import com.cheetah.start.module.system.service.SysDictDataService;
import org.noear.solon.annotation.Component;

import java.util.List;

/**
 * @author Feel
 * @create 2021/7/18
 **/
@Component
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements SysDictDataService {

    @Override
    public boolean removeByTypeCode(String typeCode) {
        QueryWrapper<SysDictData> wrapper = new QueryWrapper<>();
        wrapper.eq("type_code", typeCode);
        return remove(wrapper);
    }

    @Override
    public List<SysDictData> getByDictCode(String dictCode) {
        QueryWrapper<SysDictData> wrapper = new QueryWrapper<>();
        wrapper.eq("type_code", dictCode)
                .eq("enable", "0");
        return list(wrapper);
    }
}
